<template>
  <div class="app-container table-app-container">
    <div class="fixed-table">
      <TableFilter />
      <PageableTable
        :loading="loading"
        :data="insideTableData"
        :total="totalElements"
        :page="currentPage"
        :page-size="pageSize"
        :table-height="tableHeight"
        :multiple-selected="false"
        :disable-pageable="false"
        class="fixed-table-table"
        @page-change="onPageChange"
        @sort-change="onSortChange"
      >
        <el-table-column v-for="column in insideColumns" :key="column.key" :width="column.width" :label="column.title" :prop="column.key" :sortable="column.sortable">
          <template slot-scope="scope">
            <column-render :render="column.render" :row="scope.row" :column="column" />
          </template>
        </el-table-column>
      </PageableTable>
    </div>
  </div>
</template>

<script>
// 表格查询组件独立编写，需要传递pageable-table实例的mixin方法filter
import TableFilter from './components/tableFilter'
// 编辑实例组件独立编写，需要传递id属性，判断新建还是更新操作
import ActionBar from './components/actionBar'
import PageableTable from '@neu/biz-core/components/PageableTable'
import databind from '@neu/biz-core/mixins/databind'
import { report } from '@neu/dcom-ui/api/workDaily'

export default {
  name: 'DailyReportPage',
  components: {
    TableFilter,
    ActionBar,
    PageableTable
  },
  // 加入混入，使表格混入更多的api操作
  mixins: [databind],
  data() {
    return {
      r: report,
      insideColumns: [
        { title: '人员', key: 'incident_user_name' },
        { title: '填报天数', key: 'days' },
        { title: '服务时长（小时）', key: 'total_working_hours' },
        { title: '巡检任务（小时）', key: 'total_inspect_hours' },
        { title: '故障处理（小时）', key: 'total_malfunction_hours' },
        { title: '其它相关（小时）', key: 'total_other_hours' }
      ]
    }
  }
}
</script>
